home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revolution - Das Atari CD Magazin 1997
/
Revolution - Das Atari CD Magazin 1.iso
/
software
/
anwendng
/
qed_397
/
sourcen
/
ausgabe.c
next >
Wrap
C/C++ Source or Header
|
1997-01-07
|
23KB
|
1,089 lines
#include "global.h"
#include "fontsel.h"
#include "rsc.h"
#include "scroll.h" /* COPYB */
#include "ausgabe.h"
#define BLKANF 1
#define BLKEND 2
#define BLKFULL 4
/* lokale Variablen ********************************************************/
LOCAL UBYTE text[260];
LOCAL WORD w_text[260];
/*!! Muessen am Anfang jeder Routine gesetzt werden !!*/
LOCAL BOOLEAN tab;
LOCAL WORD tab_size;
LOCAL BOOLEAN umbrechen;
LOCAL BOOLEAN show_end;
/* lokale Prototypen *******************************************************/
LOCAL WORD w_line_to_str (LINEP a, WORD *t);
LOCAL WORD line_to_str (LINEP a, UBYTE text[]);
EXTERN VDIPB VDI_pb;
LOCAL VOID V_gtext(WORD x, WORD y, WORD *ptr, WORD anz)
{
_VDIParBlk.ptsin[0] = x;
_VDIParBlk.ptsin[1] = y;
_VDIParBlk.contrl[0] = 8;
_VDIParBlk.contrl[1] = 1;
_VDIParBlk.contrl[3] = anz;
_VDIParBlk.contrl[6] = vdi_handle;
COPYW(_VDIParBlk.intin, ptr, anz*2);
vdi(&VDI_pb);
}
LOCAL WORD Vqt_extent(WORD *ptr, WORD anz)
{
WORD w;
_VDIParBlk.contrl[0] = 116;
_VDIParBlk.contrl[1] = 0;
_VDIParBlk.contrl[3] = anz;
_VDIParBlk.contrl[6] = vdi_handle;
COPYW(_VDIParBlk.intin, ptr, anz*2);
vdi(&VDI_pb);
w = _VDIParBlk.ptsout[2] - _VDIParBlk.ptsout[0];
return w;
}
/* Liefert die interne Position */
WORD InterPos(WORD x, LINEP a, BOOLEAN tab, WORD tab_size)
{
WORD len = 0,
tabH = tab_size,
i = 0;
UBYTE *str, t;
if (!tab)
return min(x,a->len);
str = TEXT(a);
t = '\t';
while(len<x && i<a->len)
{
if ((*str++)==t)
{
len += tabH;
tabH = tab_size;
}
else
{
len++;
if ((--tabH)==0)
tabH = tab_size;
}
i++;
}
if (len > x)
i--;
return i;
}
WORD BildLen(LINEP a, BOOLEAN tab, WORD tab_size)
{
return BildPos(a->len,a,tab,tab_size);
}
WORD BildPos(WORD x, LINEP a, BOOLEAN tab, WORD tab_size)
{
WORD len = 0,
tabH = tab_size;
UBYTE *str, t;
if (x>a->len)
x = a->len;
if (!tab)
return x;
t = '\t';
str = TEXT(a);
while ((--x)>=0)
{
if ((*str++)==t)
{
len += tabH;
tabH = tab_size;
}
else
{
len++;
if ((--tabH)==0)
tabH = tab_size;
}
}
return len;
}
WORD cursor_xpos(TEXTP t_ptr, WORD pos)
{
WORD len;
tab = t_ptr->loc_opt->tab;
tab_size = t_ptr->loc_opt->tabsize;
umbrechen = t_ptr->loc_opt->umbrechen;
show_end = t_ptr->loc_opt->show_end;
if (winFont.prop)
{
w_line_to_str(t_ptr->cursor_line, w_text);
len = BildPos(pos, t_ptr->cursor_line, tab, tab_size);
len = Vqt_extent(w_text, len);
}
else
len = BildPos(pos, t_ptr->cursor_line, tab, tab_size)*gl_wchar;
return len;
}
LOCAL VOID _cursor(WINDOWP window, WORD xpos, LONG ypos, WORD w, WORD h)
{
WORD pxy[4];
/* ACHTUNG: xpos in Pixeln, ypos in Zeilen!! */
if (xpos >= 0 && xpos < window->work.w &&
ypos >= 0 && ypos < window->w_hight)
{
pxy[0] = xpos + window->work.x;
pxy[1] = (short) ypos * h + window->work.y;
pxy[2] = pxy[0] + w;
pxy[3] = pxy[1] + (h - 1);
if (ypos > 0)
pxy[1] -= 2;
if (ypos < window->w_hight-1)
pxy[3] += 2;
vswr_mode(vdi_handle, MD_XOR);
if (fill_color!=BLACK)
{
vsf_color(vdi_handle, BLACK);
fill_color = BLACK;
}
vr_recfl (vdi_handle, pxy);
vswr_mode(vdi_handle, MD_REPLACE);
}
}
VOID cursor(WINDOWP window, TEXTP t_ptr)
{
WORD xpos, breite, hoehe, pxy[8];
LONG ypos;
UBYTE c[2];
wind_update(BEG_UPDATE);
Hide_mouse();
if (overwrite)
{
if (winFont.prop)
{
strncpy(c, TEXT(t_ptr->cursor_line) + t_ptr->xpos, 1);
c[1] = EOS;
vqt_extent(vdi_handle, c, pxy);
breite = pxy[2] - pxy[0];
breite = breite ? breite : 1;
hoehe = pxy[7] - pxy[1];
}
else
{
breite = gl_wchar;
hoehe = gl_hchar;
}
}
else
{
breite = 2;
hoehe = gl_hchar;
}
ypos = t_ptr->ypos - window->doc.y;
xpos = cursor_xpos(t_ptr, t_ptr->xpos) - ((short) window->doc.x * gl_wchar);
if (free_for_draw(window))
{
set_clip(FALSE,NULL);
_cursor(window, xpos, ypos, breite, hoehe);
}
else
{
RECT a, b;
a.x = xpos + window->work.x;
a.y = (short) ypos * hoehe + window->work.y;
a.w = breite + 1;
a.h = hoehe + 1;
if (ypos > 0)
{
a.y -= 2;
a.h += 2;
}
if (ypos < window->w_hight-1)
a.h += 2;
if (rc_first(window->handle, &a, &b))
{
do
{
set_clip(TRUE, &b);
_cursor(window, xpos, ypos, breite, hoehe);
}
while(rc_next(window->handle, &b));
}
}
Show_mouse();
wind_update(END_UPDATE);
}
LOCAL LINEP get_wline(TEXTP t_ptr, LONG y)
{
LINEP lauf;
LONG i;
if (y<0 || y>=t_ptr->text.lines)
return NULL;
i = t_ptr->ypos;
lauf = t_ptr->cursor_line;
if (i>y)
{
i -= y;
while (TRUE)
{
VORG(lauf);
if ((--i)==0)
break;
VORG(lauf);
if ((--i)==0)
break;
VORG(lauf);
if ((--i)==0)
break;
VORG(lauf);
if ((--i)==0)
break;
}
}
else if (i<y)
{
y -= i;
while (TRUE)
{
NEXT(lauf);
if ((--y)==0)
break;
NEXT(lauf);
if ((--y)==0)
break;
NEXT(lauf);
if ((--y)==0)
break;
NEXT(lauf);
if ((--y)==0)
break;
}
}
return (lauf);
}
LOCAL WORD w_line_to_str(LINEP a, WORD *t)
/* Expandiert eine ganze Zeile zu einem String für die Ausgabe */
/* Tab-Zeichen werden u.U. in mehrere CHR(32) gewandelt */
/* Die Stringlänge wird zurückgegeben */
{
WORD tabH, len, i;
UBYTE *str;
WORD c, t_c, s_c;
str = TEXT(a);
s_c = ' ';
t_c = '\t';
if (tab)
{
tabH = tab_size;
for (i=a->len,len=256; (--i)>=0; )
{
c = *str++;
if (c==t_c)
{
len -= tabH;
if (len<0)
{
tabH += len;
len = 0;
}
while (TRUE)
{
*t++ = s_c;
if ((--tabH)==0)
break;
*t++ = s_c;
if ((--tabH)==0)
break;
*t++ = s_c;
if ((--tabH)==0)
break;
*t++ = s_c;
if ((--tabH)==0)
break;
}
if (len==0)
break; /* Puffer voll */
tabH = tab_size;
}
else if (c<min_ascii || c>max_ascii)
{
*t++ = s_c;
if ((--tabH)==0) tabH = tab_size;
if ((--len)==0) break; /* Puffer voll */
}
else
{
*t++ = c;
if ((--tabH)==0) tabH = tab_size;
if ((--len)==0) break; /* Puffer voll */
}
}
len = 256-len;
}
else
{
for (i=a->len,len=0; (--i)>=0 && (len<256); len++)
{
c = *str++;
if (c<min_ascii || c>max_ascii)
*t++ = s_c;
else
*t++ = c;
}
}
return(len);
}
LOCAL WORD line_to_str(LINEP a, UBYTE *t)
/* Expandiert eine ganze Zeile zu einem String für die Ausgabe */
/* Tab-Zeichen werden ggf. in mehrere CHR(32) gewandelt */
/* Die Stringlänge wird zurückgegeben */
{
WORD len, i;
UBYTE *str, c;
str = TEXT(a);
if (tab)
{
WORD tabH;
UBYTE t_c, s_c;
t_c = '\t';
s_c = ' ';
tabH = tab_size;
for (i=a->len,len=256; (--i)>=0; )
{
c = *str++;
if (c==t_c)
{
len -= tabH;
if (len<0)
{
tabH += len;
len = 0;
}
while (TRUE)
{
*t++ = s_c; if ((--tabH)==0) break;
*t++ = s_c; if ((--tabH)==0) break;
*t++ = s_c; if ((--tabH)==0) break;
*t++ = s_c; if ((--tabH)==0) break;
}
if (len==0) break; /* Puffer voll */
tabH = tab_size;
}
else if (c<min_ascii || c>max_ascii)
{
*t++ = s_c;
if ((--tabH)==0) tabH = tab_size;
if ((--len)==0) break; /* Puffer voll */
}
else
{
*t++ = c;
if ((--tabH)==0) tabH = tab_size;
if ((--len)==0) break; /* Puffer voll */
}
}
len = 256-len;
len++;
*t = EOS;
}
else
{
for (i=a->len,len=0; (--i)>=0 && (len<256); len++)
{
c = *str++;
if (c<min_ascii || c>max_ascii)
*t++ = ' ';
else
*t++ = c;
}
len++;
*t = EOS;
}
return(len);
}
VOID outc(WORD x, WORD y, WORD w)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
{
WORD pxy[4];
if (w<=0) return;
pxy[0] = x;
pxy[1] = y;
pxy[2] = w+x-1;
pxy[3] = y+gl_hchar-1;
if (fill_color!=WHITE)
{
vsf_color(vdi_handle,WHITE);
fill_color = WHITE;
}
vr_recfl (vdi_handle, pxy); /* Bereich löschen */
}
VOID outcB(WORD x, WORD y, WORD w)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
{
WORD pxy[4];
if (w<=0) return;
pxy[0] = x;
pxy[1] = y;
pxy[2] = w+x-1;
pxy[3] = y+gl_hchar-1;
if (fill_color!=BLACK)
{
vsf_color(vdi_handle,BLACK);
fill_color = BLACK;
}
vr_recfl (vdi_handle, pxy); /* Bereich löschen */
}
WORD outs(WORD x, WORD y, WORD w, CONST UBYTE *str)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
/* return ende der Textausgabe */
{
WORD pxy[8], len;
if (w <= 0)
return x;
v_gtext(vdi_handle, x, y, (UBYTE*)str);
if (winFont.prop)
{
vqt_extent(vdi_handle,(UBYTE*)str,pxy);
len = pxy[2]-pxy[0];
}
else
len = (short) strlen(str) * gl_wchar;
if (len<w)
{
pxy[0] = len+x;
pxy[1] = y;
pxy[2] = x+w-1;
pxy[3] = y+gl_hchar-1;
if (fill_color!=WHITE)
{
vsf_color(vdi_handle,WHITE);
fill_color = WHITE;
}
vr_recfl (vdi_handle, pxy); /* Bereich löschen */
return x+len;
}
return x+w;
}
WORD outsB(WORD x, WORD y, WORD w, CONST UBYTE *str)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
/* return ende der Textausgabe */
{
WORD pxy[8], len;
if (w <= 0)
return x;
pxy[0] = x;
pxy[1] = y;
pxy[2] = x+ w -1;
pxy[3] = y+ gl_hchar -1;
if (fill_color!=BLACK)
{
vsf_color(vdi_handle,BLACK);
fill_color = BLACK;
}
vr_recfl(vdi_handle, pxy);
vswr_mode(vdi_handle, MD_XOR);
v_gtext(vdi_handle, x, y, (UBYTE*)str);
vswr_mode(vdi_handle, MD_REPLACE);
if (winFont.prop)
{
vqt_extent(vdi_handle,(UBYTE*)str,pxy);
len = pxy[2]-pxy[0];
}
else
len = (short) strlen(str) * gl_wchar;
if (len > w)
return x+w;
return x+len;
}
LOCAL VOID draw_cr(WORD x, WORD y)
{
WORD pxy[6], h, b;
b = min(gl_wchar,gl_hchar);
h = b>>1;
y += (gl_hchar>>1);
pxy[0] = x+b-1; /* oben rechts */
pxy[1] = y-h;
pxy[2] = x+b-1; /* mitte rechst */
pxy[3] = y;
pxy[4] = x; /* mitte links */
pxy[5] = y;
v_pline (vdi_handle, 3, pxy);
h = h>>1;
pxy[0] = x+h; /* schräg oben */
pxy[1] = y-h;
pxy[2] = x; /* mitte links */
pxy[3] = y;
pxy[4] = x+h; /* schräg unten */
pxy[5] = y+h;
v_pline (vdi_handle, 3, pxy);
}
LOCAL VOID draw_crB(WORD x, WORD y)
{
WORD pxy[6], h, b;
vsl_color (vdi_handle, WHITE);
b = min(gl_wchar,gl_hchar);
h = b>>1;
y += (gl_hchar>>1);
pxy[0] = x+b-1; /* oben rechts */
pxy[1] = y-h;
pxy[2] = x+b-1; /* mitte rechst */
pxy[3] = y;
pxy[4] = x; /* mitte links */
pxy[5] = y;
v_pline (vdi_handle, 3, pxy);
h = h>>1;
pxy[0] = x+h; /* schräg oben */
pxy[1] = y-h;
pxy[2] = x; /* mitte links */
pxy[3] = y;
pxy[4] = x+h; /* schräg unten */
pxy[5] = y+h;
v_pline (vdi_handle, 3, pxy);
vsl_color (vdi_handle, BLACK);
}
LOCAL VOID str_out(WORD x, WORD y, WORD w, WORD offset, LINEP a)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
/* offset in Zeichen */
{
WORD len, anz;
WORD pxy[4];
anz = w_line_to_str(a, w_text);
if (winFont.prop)
{
offset *= gl_wchar;
x -= offset;
w += offset;
V_gtext(x, y, w_text, anz);
len = Vqt_extent(w_text,anz);
if (len<w)
{
pxy[0] = x+len;
pxy[1] = y;
pxy[2] = x+w-1;
pxy[3] = y+gl_hchar-1;
if (fill_color!=WHITE)
{
vsf_color(vdi_handle,WHITE);
fill_color = WHITE;
}
vr_recfl (vdi_handle, pxy); /* Bereich löschen */
if (umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(x+len,y);
}
}
else
{
if (offset>=anz)
{
outc(x,y,w);
if (offset==anz && umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(x,y);
}
else
{
anz -= offset;
len = anz*gl_wchar;
if (w<=len)
{
V_gtext(x, y, w_text+offset, w/gl_wchar);
}
else
{
V_gtext(x, y, w_text+offset, anz);
pxy[0] = x+len;
pxy[1] = y;
pxy[2] = x+w-1;
pxy[3] = y+gl_hchar-1;
if (fill_color!=WHITE)
{
vsf_color(vdi_handle,WHITE);
fill_color = WHITE;
}
vr_recfl (vdi_handle, pxy); /* Bereich löschen */
if (umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(x+len,y);
}
}
}
}
LOCAL VOID str_outB(WORD x, WORD y, WORD w, WORD offset, LINEP a, WORD mode, WORD x1, WORD x2)
/* x ist Pixel-Koordinate */
/* y ist Pixel-Koordinate */
/* w ist die Breite in Pixel, die abgedeckt werden soll */
/* offset in Zeichen */
/* mode (BLKANF, BLKEND, BLKFULL) */
{
WORD anz, anz1, anz2, len, len2, pxy[8], end;
UBYTE h;
anz = line_to_str(a, text);
if (anz <= offset) /* ganze Zeile weiss oder schwarz ohne Text */
{
if (winFont.prop)
{
vqt_extent(vdi_handle,text,pxy);
end = x-(offset*gl_wchar)+(pxy[2]-pxy[0]);
}
else
end = x-(offset*gl_wchar)+anz*gl_wchar;
if (mode == BLKFULL || mode == BLKANF)
{
outcB(x,y,w);
if (end >= x && end < x+w && umbrechen && (a->info & ABSATZ) && show_end)
draw_crB(end,y);
}
else
{
outc(x,y,w);
if (end>=x && end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(end,y);
}
return;
}
if (winFont.prop)
{
offset *= gl_wchar;
x -= offset;
w += offset;
if (mode==BLKFULL)
/* Ganze Zeile einheitlich invers */
{
end = outsB(x,y,w,text);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_crB(end,y);
}
else
/* Blockanfang oder -ende oder beides */
{
if (mode==BLKANF)
{
anz1 = BildPos(x1,a,tab,tab_size);
h = text[anz1]; text[anz1] = EOS;
vqt_extent(vdi_handle,text,pxy);
len = pxy[2]-pxy[0];
end = outs(x,y,len,text);
text[anz1] = h;
end = outsB(end,y,w-len,text+anz1);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_crB(end,y);
}
else if (mode==BLKEND)
{
anz1 = BildPos(x2,a,tab,tab_size);
h = text[anz1]; text[anz1] = EOS;
vqt_extent(vdi_handle,text,pxy);
len = pxy[2]-pxy[0];
end = outsB(x,y,len,text);
text[anz1] = h;
end = outs(end,y,w-len,text+anz1);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(end,y);
}
else /* (mode==(BLKANF+BLKEND) */
{
anz1 = BildPos(x1,a,tab,tab_size);
h = text[anz1]; text[anz1] = EOS;
vqt_extent(vdi_handle,text,pxy);
len = pxy[2]-pxy[0];
end = outs(x,y,len,text);
text[anz1] = h;
anz2 = BildPos(x2,a,tab,tab_size);
h = text[anz2]; text[anz2] = EOS;
vqt_extent(vdi_handle,text+anz1,pxy);
len2 = pxy[2]-pxy[0];
end = outsB(end,y,len2,text+anz1);
text[anz2] = h;
end = outs(end,y,w-len-len2,text+anz2);
if (end < x+w && umbrechen && (a->info & ABSATZ) && show_end)
draw_cr(end,y);
}
}
}
else
{
UBYTE *ptr = text+offset;
anz -= offset;
if (anz * gl_wchar > w)
{
anz = w/gl_wchar;
ptr[anz] = EOS;
}
if (mode == BLKFULL)
/* Ganze Zeile einheitlich invers */
{
end = outsB(x,y,w,ptr);
if (end < x+w && umbrechen && (a->info & ABSATZ) && show_end)
draw_crB(end, y);
}
else
/* Blockanfang oder -ende oder beides */
{
if (mode==BLKANF)
{
anz1 = BildPos(x1,a,tab,tab_size)-offset;
if (anz1<0) anz1 = 0;
if (anz1>anz) anz1 = anz;
h = ptr[anz1]; ptr[anz1] = EOS;
len = anz1*gl_wchar;
end = outs(x,y,len,ptr);
ptr[anz1] = h;
end = outsB(end,y,w-len,ptr+anz1);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_crB(end,y);
}
else if (mode==BLKEND)
{
anz1 = BildPos(x2,a,tab,tab_size)-offset;
if (anz1<0) anz1 = 0;
if (anz1>anz) anz1 = anz;
h = ptr[anz1]; ptr[anz1] = EOS;
len = anz1*gl_wchar;
end = outsB(x,y,len,ptr);
ptr[anz1] = h;
end = outs(end,y,w-len,ptr+anz1);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(end,y);
}
else /* (mode==(BLKANF+BLKEND) */
{
anz1 = BildPos(x1,a,tab,tab_size)-offset;
if (anz1<0) anz1 = 0;
if (anz1>anz) anz1 = anz;
h = ptr[anz1]; ptr[anz1] = EOS;
len = anz1*gl_wchar;
end = outs(x,y,len,ptr);
ptr[anz1] = h;
anz2 = BildPos(x2,a,tab,tab_size)-offset;
if (anz2<0) anz2 = 0;
if (anz2>anz) anz2 = anz;
h = ptr[anz2]; ptr[anz2] = EOS;
len2 = anz2*gl_wchar - len;
end = outsB(end,y,len2,ptr+anz1);
ptr[anz2] = h;
end = outs(end,y,w-len-len2,ptr+anz2);
if (end<x+w && umbrechen && (a->info&ABSATZ) && show_end)
draw_cr(end,y);
}
}
}
}
/* =========================================================== */
VOID line_out(WINDOWP window, TEXTP t_ptr, WORD wy)
{
WORD y;
LINEP col;
RECT c;
tab = t_ptr->loc_opt->tab;
tab_size = t_ptr->loc_opt->tabsize;
umbrechen = t_ptr->loc_opt->umbrechen;
show_end = t_ptr->loc_opt->show_end;
if (winFont.prop)
{
if (!get_clip(&c))
set_clip(TRUE,&window->work);
else
{
myrc_intersect(&window->work,&c);
set_clip(TRUE,&c);
}
}
y = window->work.y+wy*gl_hchar;
col = get_wline(t_ptr, window->doc.y+wy);
if (col!=NULL) /* Kommt vor */
{
if (t_ptr->block)
{
wy += (short) window->doc.y;
if (wy<t_ptr->z1 || wy>t_ptr->z2)
str_out(window->work.x, y, window->work.w, (short)window->doc.x, col);
else
{
WORD mode = 0;
if (wy == t_ptr->z1)
mode |= BLKANF;
if (wy == t_ptr->z2)
mode |= BLKEND;
if (!mode)
mode = BLKFULL;
str_outB(window->work.x, y, window->work.w,
(short) window->doc.x, col, mode, t_ptr->x1, t_ptr->x2);
}
}
else
str_out(window->work.x, y, window->work.w, (short) window->doc.x, col);
}
else
outc(window->work.x, y, window->work.w);
}
VOID bild_out(WINDOWP window, TEXTP t_ptr)
{
WORD x, y, w, xy[4];
LINEP lauf;
WORD MIN_COL, MAX_COL, MAX_Y;
RECT c;
tab = t_ptr->loc_opt->tab;
tab_size = t_ptr->loc_opt->tabsize;
umbrechen = t_ptr->loc_opt->umbrechen;
show_end = t_ptr->loc_opt->show_end;
x = window->work.x;
y = window->work.y;
w = window->work.w;
if (window->class == CLASS_EDIT) /* Kopf ausgeben */
head_out(window, t_ptr);
MIN_COL = 0;
MAX_COL = (short) min(window->w_hight - 1, t_ptr->text.lines - window->doc.y-1);
MAX_Y = y + window->work.h-1;
if (get_clip(&c)) /* nicht alles malen */
{
WORD y2 = c.y-y;
MIN_COL = max(MIN_COL,y2/gl_hchar);
MAX_COL = min(MAX_COL, (c.y+c.h-1)/gl_hchar);
MAX_Y = min(MAX_Y, c.y+c.h-1);
}
if (winFont.prop)
{
if (!get_clip(&c))
set_clip(TRUE,&window->work);
else
{
myrc_intersect(&window->work,&c);
set_clip(TRUE,&c);
}
}
y += (MIN_COL*gl_hchar);
lauf = get_wline(t_ptr, window->doc.y+MIN_COL);
if (lauf!=NULL)
{
WORD xoffset, i;
xoffset = (short) window->doc.x;
if (t_ptr->block)
{
LONG y_r;
y_r = window->doc.y+MIN_COL;
for (i=MIN_COL ; i<=MAX_COL; y_r++,y+=gl_hchar,NEXT(lauf),i++)
{
/* Block nicht sichtbar */
if (y_r < t_ptr->z1 || y_r > t_ptr->z2)
str_out(x, y, w, xoffset, lauf);
else
{
WORD mode = 0;
if (y_r == t_ptr->z1)
mode |= BLKANF;
if (y_r == t_ptr->z2)
mode |= BLKEND;
if (!mode)
mode = BLKFULL;
str_outB(x, y, w, xoffset, lauf, mode, t_ptr->x1, t_ptr->x2);
}
}
}
else
{
for (i=MIN_COL ; i<=MAX_COL; y+=gl_hchar,NEXT(lauf),i++)
str_out(x,y,w,xoffset,lauf);
}
}
if (y<MAX_Y)
{
xy[0] = x;
xy[1] = y;
xy[2] = x+w-1;
xy[3] = MAX_Y;
if (fill_color!=WHITE)
{
vsf_color(vdi_handle,WHITE);
fill_color = WHITE;
}
vr_recfl (vdi_handle, xy); /* Bereich löschen */
}
}
VOID bild_blkout(WINDOWP window, TEXTP t_ptr, LONG z1, LONG z2)
/* Alle Textzeilen zwischen z1 und z2 werden neu ausgegeben */
{
WORD i, x, y, w, xoffset;
LINEP lauf;
WORD MAX_COL;
LONG lines, y_r;
RECT c;
tab = t_ptr->loc_opt->tab;
tab_size = t_ptr->loc_opt->tabsize;
umbrechen = t_ptr->loc_opt->umbrechen;
show_end = t_ptr->loc_opt->show_end;
if (z1>z2)
{
lines = z1;
z1 = z2;
z2 = lines;
}
if (winFont.prop)
{
if (!get_clip(&c))
set_clip(TRUE,&window->work);
else
{
myrc_intersect(&window->work,&c);
set_clip(TRUE,&c);
}
}
x = window->work.x;
y = window->work.y;
w = window->work.w;
xoffset = (short) window->doc.x;
MAX_COL = (short) min(window->w_hight-1, t_ptr->text.lines-window->doc.y-1);
y_r = window->doc.y;
lauf = get_wline(t_ptr, y_r);
if (t_ptr->block)
for (i=0; i<=MAX_COL; i++,y+=gl_hchar,y_r++)
{
if (y_r>=z1 && y_r<=z2)
{
if (y_r<t_ptr->z1 || y_r>t_ptr->z2)
str_out(x,y,w,xoffset,lauf);
else
{
WORD mode = 0;
if (y_r==t_ptr->z1) mode |= BLKANF;
if (y_r==t_ptr->z2) mode |= BLKEND;
if (!mode) mode = BLKFULL;
str_outB(x,y,w,xoffset,lauf,mode,t_ptr->x1,t_ptr->x2);
}
}
NEXT(lauf);
}
else
for (i=0; i<=MAX_COL; i++,y+=gl_hchar,y_r++)
{
if (y_r>=z1 && y_r<=z2)
str_out(x,y,w,xoffset,lauf);
NEXT(lauf);
}
}
/***************************************************************************/
VOID head_out(WINDOWP window, TEXTP t_ptr)
{
UBYTE head_str[WINSTRLEN];
WORD len, head_len;
if (t_ptr->info_str[0] != EOS)
{
strcpy(head_str, t_ptr->info_str);
head_len = (short) strlen(head_str);
}
else
{
head_len = (short) strlen(STRING(HEADSTR));
COPYB(head_str, STRING(HEADSTR), head_len + 1);
if (t_ptr->readonly)
head_str[1] = '\x7F';
switch (t_ptr->ending)
{
case tos :
break;
case unix :
head_str[2] = 'U';
break;
case apple :
head_str[2] = 'A';
break;
default:
head_str[2] = '?';
}
ltoa(t_ptr->ypos+1, head_str + 8, 10);
head_str[strlen(head_str)] = ' ';
itoa(BildPos(t_ptr->xpos,t_ptr->cursor_line,tab,tab_size)+1,head_str+18,10);
head_str[strlen(head_str)] = ' ';
}
len = window->work.w / sys_wchar;
if (len < head_len)
head_str[len] = EOS;
set_winfo(window, head_str);
}
/***************************************************************************/